<meta charset="UTF-8">

<?php

include_once("../functions/db_manipulate.php");
if (!init()) {
    redirect('login.php');
}

connectDB();
startTransaction();

$resultSet = mysql_query("INSERT INTO entergroup(userid, groupid)
                          VALUES ('" . mysql_real_escape_string($_SESSION['id']) . "','" . mysql_real_escape_string($_GET['gid']) . "')");

if ($resultSet) {
    commitTransaction();
    redirect($_SERVER['HTTP_REFERER']);
} else {
    rollbackTransaction();
    redirect($_SERVER['HTTP_REFERER']);
}
?>
